Skip to content

Conversation

ptrcnull
Copy link

No description provided.

@orgads
Copy link

orgads commented Jul 12, 2020

ping?

on(event: 'headers', cb: (this: WebSocket.Server, headers: string[], request: http.IncomingMessage) => void): this;
on(event: 'listening', cb: (this: WebSocket.Server) => void): this;
on(event: 'stream', cb: (this: WebSocket.Server, stream: WebSocketDuplex, request: http.IncomingMessage) => void): this;
on(event: string | symbol, listener: (this: WebSocket.Server, ...args: any[]) => void): this;
}

function createServer(opts?: WebSocket.ServerOptions, callback?: () => void): Server;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function createServer(opts?: WebSocket.ServerOptions, callback?: () => void): Server;
function createServer(opts?: WebSocket.ServerOptions, callback?: (...args: any[]) => void): Server;

I don't mind raising this as a separate PR, but this callback can take parameters,

if you look whats passed into the callback you can see that this is passed into this.on('stream', cb) in server.js

which is a method on its super class WebSocketServer which is part of the ws package

Screenshot 2024-03-18 at 14 00 45
In there they have many different callback types

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my brother in christ, this has been open for 4 years now

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah actually there is another ticket raised about this here #158 - don't worry

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look Good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants